package com.carkeeper.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.carkeeper.pojo.ComponentPO;
import com.carkeeper.pojo.ServiceTypePO;
import org.apache.ibatis.annotations.*;

/**
 * @author ：XXX
 * @date ：Created in 2020/6/3
 * @description ：
 * @version: 1.0
 */
@Mapper
public interface ComponentMapper extends BaseMapper<ComponentPO> {
    @Results(id="componentMapper",value = {
            @Result(property = "storePo",column = "business_code",one = @One(select =
                    "com.carkeeper.mapper.StoreMapper.findByCode")),
            @Result(property = "compTypePO",column = "component_type_id",one = @One(select =
                    "com.carkeeper.mapper.CompTypeMapper.selectById")),
            @Result(property = "compSubTypePO",column = "component_sub_type_id",one = @One(select =
                    "com.carkeeper.mapper.CompTypeMapper.selectById")),
            @Result(property = "componentBrandPO",column = "component_brand_id",one = @One(select =
                    "com.carkeeper.mapper.ComponentBrandMapper.selectById"))
    })
    @Select("select * from tb_component where id=#{id}")
    ComponentPO findComponentById(Long id);
}
